import { HttpError } from 'routing-controllers';

export class HttpException extends HttpError {
  public status: number = 200;
  public message: string;
  public code: number;

  constructor(code: number, message: string) {
    super(200, message);
    this.code = code;
    this.message = message;
  }
}

// 请求参数错误异常
export class BadRequestException extends HttpException {
  constructor(message: string = '参数错误') {
    super(400, message);
  }
}

// 服务器内部错误异常
export class ServerErrorException extends HttpException {
  constructor(message: string = '服务器内部错误') {
    super(500, message);
  }
}
